home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / WE_30D.ZIP / WINEDIT.MN_ < prev    next >
Text File  |  1993-09-04  |  15KB  |  425 lines

  1. ; AutoExec Section is on top here.  Actually runs before file manager
  2. ; appears on the screen
  3. ;
  4.         TAB=num2char(9)
  5.         CR=strcat(num2char(13),num2char(10))
  6.         Home=DirHome()
  7.  
  8. Edit Utility Menu   ; Manage WinEdit Utility menu and help files
  9.         TheFile=strcat(DirHome(),"WINEDIT.MNU")
  10.         WFileOpen(TheFile)
  11.         Drop(TheFile)
  12.  
  13. Edit Macro Menu   ; Manage WinEdit Macro menu
  14.         ; In the lite and standard versions of WinEdit,
  15.         ; the MACRO.ENC file is not editable.
  16.         ; In the Pro version, the file MACRO.MNU is used
  17.         ; and it can be edited.
  18.         level=2
  19.         a = FileLocate("WINEDIT.INI")
  20.         if FileExist(a) then level=IniReadPvt("WINEDIT","LEVEL","2",a)
  21.         if (level < 2) then Message("Edit Macro Menu","The Macro Menu cannot be edited in the Lite or Standard versions of WinEdit")
  22.         if (level < 2) then exit
  23.         ; else we can edit it
  24.         TheFile=strcat(DirHome(),"MACRO.MNU")
  25.         WFileOpen(TheFile)
  26.         Drop(TheFile)
  27.  
  28. _Key Word Help      \ +{F1}         ; Load help topic for word at cursor
  29.         call("wwwedit.dll","KEYWORDHELP")
  30.  
  31. Load Help File                    ; Load a help file (no keyword lookup)
  32.         TheFile=strcat(DirHome(),"HELP\WEHELP.INI")
  33.         Keys=IniItemizePvt("HelpAll",TheFile)
  34.         KeyMax=ItemCount(Keys,TAB)
  35.         KeyIndex=0
  36.         KeyValues=""
  37.  
  38.         :ieLoop
  39.         if KeyIndex==KeyMax then goto looped
  40.         KeyIndex=KeyIndex+1
  41.         ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  42.         if (stricmp(ThisKey,"DEFAULT")==0) then goto ieloop
  43.         ThisValue=IniReadPvt("HelpAll",ThisKey,"???",TheFile)
  44.         KeyValues=strcat(KeyValues,ThisValue,"|")
  45.         goto ieLoop
  46.         
  47.         :looped
  48.         a=ItemSelect("Select Help File",strlower(KeyValues),"|")
  49.         if a=="" then goto DONE
  50.         b = FileLocate(strcat(DirHome(),"HELP\%a%"))
  51.         if b=="" then b=FileLocate(a)
  52.         if b=="" then Message("Helpfile %a% not found","Edit %TheFile%%CR%[HelpAll] section to%CR%point to help file location%CR%or put helpfile on DOS path.")
  53.                  else WinHelp(b,"CONTENTS","")
  54.         :DONE
  55.         Drop(TheFile,Keys,KeyMax,KeyIndex,KeyValues,ThisKey,ThisValue,a,b)
  56.  
  57. Open highlighted file           ; Open highlighted file
  58.         name = wEdGetWord()
  59.         length = strlen(name)
  60.         if length==0 then goto DONE
  61.         b = FileLocate(name)
  62.         if b == "" then Message("Open highlighted file","Cannot find %name%")
  63.         if b == "" then goto DONE
  64.         wFileOpen(b)
  65.         :DONE
  66.         drop(name,length)
  67.  
  68. Generate C Tags                   ; Index source files
  69.         ; uses the TAGS.EXE program to generate WINEDIT.MRK file
  70.         ; that the next function uses to look up function names
  71.         ; in your source
  72.         RunWait("TAGS.EXE","-om -tWINEDIT.MRK *.c")
  73.         Message("Tags","Processing complete")
  74.  
  75. Go to tag                         ; Jump to function definition
  76.         ; looks up the current word in WINEDIT.MRK, loads the file,
  77.         ; and moves the cursor to the correct line
  78.         DEBUG(1)
  79.         goto START
  80.         :GETWORD
  81.         a = AskLine("Go to tag", "Enter function definition to jump to:", "")
  82.         strupper(a)
  83.         len = strlen(a)
  84.         if len==0 then goto NOWORD
  85.         goto START2
  86.         :START
  87.         a=WEdGetWord()
  88.         strupper(a)
  89.         len = strlen(a)
  90.         if len==0 then goto GETWORD
  91.         :START2
  92.         b=FileLocate("winedit.mrk")
  93.         WFileOpen(b)
  94.         WFind(a,@TRUE,@FALSE)
  95.         WEdHome()
  96.         WEdStartSel()
  97.         WEdEnd()
  98.         WEdEndSel()
  99.         WEdCopy()
  100.         WWinClose()
  101.         line=ClipGet()
  102.         line2=strupper(line)
  103.         c=StrIndex(line2,a,0,@FWDSCAN)
  104.         d=StrIndex(line2," ",c,@FWDSCAN)
  105.         e=StrIndex(line2,"(",d,@FWDSCAN)
  106.         filename=StrSub(line2,d,e-d)
  107.         lineno=StrSub(line2,e+1,strlen(line2)-e-1)
  108.         WFileOpen(filename)
  109.         WEdGoToLine(lineno)
  110.         WEdHome()
  111.         Drop(len,b,line,line2,c,d,e,filename,lineno)
  112.         :NOWORD
  113.         Drop(a)
  114.  
  115.  
  116. Grep    \      ^G             ; Run fgrep
  117.         GrepWord = wEdGetWord()         ; Get Selected word if any
  118.         command = AskLine("Grep","Enter the grep commmand to run:","tee.com fgrep -M %GrepWord% *.c")
  119.         wRunCommand(command,@TRUE,@TRUE)
  120.         Drop(command,GrepWord);
  121.  
  122. &Version Control          ; PVCS commands
  123.  &Get a file (w/lock)
  124.         a = AskLine("PVCS Get (w/lock) Command", "Enter file you want to lock:", "")
  125.         b=strcat("tee get -L ",a)
  126.         wRunCommand(b,@TRUE,@TRUE)
  127.         Drop(b)
  128.         b=FileLocate(a)
  129.         if b=="" then goto NotFound
  130.           WFileOpen(b)
  131.           goto DONE
  132.         :NotFound
  133.           Message("???", "%a% not found...")
  134.           goto Done
  135.         :DONE
  136.         Drop(a)
  137.         Drop(b)
  138.  
  139.  &Put a file back (unlock)
  140.         a = AskLine("PVCS Put (unlock) Command", "Enter file you want to put back:", "")
  141.         a=strcat("tee put ",a)
  142.         wRunCommand(a,@TRUE,@TRUE)
  143.         Drop(a)
  144.  
  145.  &Enter any PVCS command
  146.         a = AskLine("PVCS Command", "Enter PVCS command:", "")
  147.         a=strcat("tee ",a)
  148.         wRunCommand(a,@TRUE,@TRUE)
  149.         Drop(a)
  150.  
  151.  &Logfile Info (locked)
  152.         a = AskLine("PVCS Logfile Command", "Enter file for which you want logfile info:", "")
  153.         a=strcat("tee vlog -BL ",a)
  154.         wRunCommand(a,@TRUE,@TRUE)
  155.         Drop(a)
  156.  
  157.  &Update all source files
  158.         wRunCommand("tee get -u *.??v",@TRUE,@TRUE)
  159.  
  160. Utilities      ;      Select from list of utilities
  161.  &Freespace on Local Drives   ; Display free disk space on drives
  162.  
  163.         Drive=DiskScan(2)     ; 2 is the code for local hard drives
  164.         Dmax=strlen(Drive)
  165.         DIndex=1
  166.         TotalSize=0
  167.         DriveReport=""
  168.  
  169.         :COUNTSPACE
  170.         NextDrive=StrSub(Drive,Dindex,1)
  171.         a=DiskFree(NextDrive)/1024
  172.         TotalSize=a+TotalSize
  173.         DriveReport=strcat(DriveReport,NextDrive," = ",a,"K","@")
  174.         DIndex=Dindex+3  ;each entry is 3 bytes long
  175.         if DIndex<=Dmax then goto COUNTSPACE
  176.         ItemSelect("Total Space Available = %TotalSize%K",DriveReport,"@")
  177.         Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive)
  178.  
  179.  &Wallpaper                   ; Change the desktop wallpaper
  180.            DirChange(dirWindows(0))
  181.            a=FileItemize("*.BMP")
  182.            a=strcat("-None- ",a)
  183.            a=ItemSelect("Select New Wallpaper",a," ")
  184.            terminate(a=="","Wallpaper","No wallpaper selected")
  185.            if a=="-None-" then Wallpaper("",0)
  186.            if a=="-None-" then exit
  187.            tile=@FALSE
  188.            if FileSize(a)<40000 then tile=@TRUE  
  189.            ;if bmp size less than 40K, assume tile, else center
  190.            Wallpaper(a,tile)
  191.            drop(a,b,tile)
  192.  Edit &INI files              ; Assisted editing of INI files
  193.         DirChange(DirWindows(0))
  194.         canned="BYEBYE"
  195.         IniFiles=""
  196.  
  197.         :UP1
  198.         canned="byebye"
  199.         If IniFiles!="" then goto inied
  200.         IniFiles=FileItemize("*.INI")
  201.         :inied
  202.         TheFile=ItemSelect("Choose Desired INI file",IniFiles," ")
  203.         if TheFile=="" then goto newini
  204.         Sections=""
  205.  
  206.         :UP2
  207.         canned="up1"
  208.         if Sections!="" then goto sected
  209.         Sections=IniItemizePvt("",TheFile)
  210.         :SECTED
  211.         Section=ItemSelect("%TheFile% - Choose Section",Sections,TAB)
  212.         if Section=="" then goto AddSect
  213.         KeyValues=""
  214.  
  215.         :UP3
  216.         canned="up2"
  217.         if KeyValues!="" then goto looped
  218.         Keys=IniItemizePvt(Section,TheFile)
  219.         KeyMax=ItemCount(Keys,TAB)
  220.         KeyIndex=0
  221.  
  222.         :Loop
  223.         if KeyIndex==KeyMax then goto looped
  224.         KeyIndex=KeyIndex+1
  225.         ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  226.         ThisValue=IniReadPvt(Section,ThisKey,"???",TheFile)
  227.         KeyValues=strcat(KeyValues,ThisKey,"= ",ThisValue,TAB)
  228.         goto Loop
  229.  
  230.         :looped
  231.         Key=ItemSelect("%TheFile% [%Section%] - Choose Keyword",KeyValues,TAB)
  232.         if Key=="" then goto AddKey
  233.         Key